module rename_test #(
    parameter RENAME_WIDTH = 4,
    parameter COMMIT_WIDTH = 2,
    parameter GC_NUM = 64
) (
    input clk,
    input rst,

    // From Frontend
    input i_valid,
    input i_fop_valid[RENAME_WIDTH-1:0],
    input [4:0] i_fop_dop_rs1[RENAME_WIDTH-1:0],
    input [4:0] i_fop_dop_rs2[RENAME_WIDTH-1:0],
    input [4:0] i_fop_dop_rd[RENAME_WIDTH-1:0],
    input i_fop_dop_has_rd[RENAME_WIDTH-1:0],
    output i_ready,

    // To next Stage
    output o_valid,
    output PRF_IDX o_rop_prs0[RENAME_WIDTH-1:0],
    output PRF_IDX o_rop_prs1[RENAME_WIDTH-1:0],
    output PRF_IDX o_rop_pdst[RENAME_WIDTH-1:0],
    output PRF_IDX o_rop_free_pdst[RENAME_WIDTH-1:0],
    output ARF_IDX o_rop_ard[RENAME_WIDTH-1:0],
    output FREELIST_IDX o_rop_freelist_rptr[RENAME_WIDTH-1:0],
    output o_rop_has_gc[RENAME_WIDTH-1:0],
    output o_rop_has_rd[RENAME_WIDTH-1:0],
    output o_rop_valid[RENAME_WIDTH-1:0],
    input o_ready,

    // From Commit Stage
    input i_commit_valid[COMMIT_WIDTH-1:0],
    input i_commit_data_has_gc[COMMIT_WIDTH-1:0],
    input i_commit_data_has_rd[COMMIT_WIDTH-1:0],
    input PRF_IDX i_commit_data_free_entry[COMMIT_WIDTH-1:0],
    input i_commit_data_restore_gc[COMMIT_WIDTH-1:0],
    input FREELIST_IDX i_commit_data_restore_freelist_rptr[COMMIT_WIDTH-1:0],
    output i_commit_ready
);
  FrontendOP i_fop[RENAME_WIDTH-1:0];
  RenamedOP o_rop[RENAME_WIDTH-1:0];
  COMMIT_TO_RENAME i_commit_data[COMMIT_WIDTH-1:0];

  always_comb begin
    integer i;
    for (i = 0; i < RENAME_WIDTH; i = i + 1) begin
      i_fop[i] = 'b0;
      i_fop[i].dop.rs1 = i_fop_dop_rs1[i];
      i_fop[i].dop.rs2 = i_fop_dop_rs2[i];
      i_fop[i].dop.rd = i_fop_dop_rd[i];
      i_fop[i].dop.has_rd = i_fop_dop_has_rd[i];
      o_rop_prs0[i] = o_rop[i].prs0;
      o_rop_prs1[i] = o_rop[i].prs1;
      o_rop_pdst[i] = o_rop[i].pdst;
      o_rop_free_pdst[i] = o_rop[i].free_pdst;
      o_rop_freelist_rptr[i] = o_rop[i].freelist_rptr;
      o_rop_has_gc[i] = o_rop[i].has_gc;
      o_rop_has_rd[i] = o_rop[i].fop.dop.has_rd;
      o_rop_ard[i] = o_rop[i].fop.dop.rd;
    end
    for (i = 0; i < COMMIT_WIDTH; i = i + 1) begin
      i_commit_data[i] = 'b0;
      i_commit_data[i].has_rd = i_commit_data_has_rd[i];
      i_commit_data[i].has_gc = i_commit_data_has_gc[i];
      i_commit_data[i].free_entry = i_commit_data_free_entry[i];
      i_commit_data[i].restore_gc = i_commit_data_restore_gc[i];
      i_commit_data[i].restore_freelist_rptr = i_commit_data_restore_freelist_rptr[i];
    end
  end

  rename #(RENAME_WIDTH, COMMIT_WIDTH, GC_NUM) inst_rename (.*);
endmodule

